//
//  MyPersonalcentersetupView.m
//  Gxj
//
//  Created by 💋索少杰 on 2017/9/19.
//  Copyright © 2017年 wkq. All rights reserved.
//

#import "MyPersonalcentersetupView.h"
#import <SDAutoLayout.h>
@implementation MyPersonalcentersetupView

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
    
        self.backgroundColor=[UIColor whiteColor];
        
        [self addSubview:self.iconView];
        [_iconView addSubview:self.imageIcon];  // 头像
        [self addSubview:self.nickname];    // 名称标签
        [self addSubview:self.modifyName];  // 名称输入框
        [self addSubview:self.sexLab];   // 性别标签
        [self addSubview:self.sexTF];    // 性别输入框
        [self addSubview:self.birthdayLab];  // 生日标签
        [self addSubview:self.birthdayTF];  // 生日输入框
        [self addSubview:self.descriptionLab];  // 自我描述标签
        [self addSubview:self.descriptionTF];   // 自我描述输入框
        [self addSubview:self.hobbyLab];    // 个人爱好标签
        
        [self addSubview:self.Line1];
        [self addSubview:self.Line2];
        [self addSubview:self.Line3];
        [self addSubview:self.Line4];
        //适配
        [self showLoginView];
    }
    return self;
}

- (void)showLoginView
{
    _iconView.sd_layout
    .topSpaceToView(self, kHeightScale(80))
    .leftSpaceToView(self, kWidthScale(272/2))
    .widthIs(kWidthScale(100))
    .heightIs(kHeightScale(100));
    
    _imageIcon.sd_layout
    .topSpaceToView(self.iconView, kHeightScale(5))
    .leftSpaceToView(self.iconView, kWidthScale(5))
    .widthIs(kWidthScale(90))
    .heightIs(kHeightScale(90));
    
    _nickname.sd_layout
    .topSpaceToView(self.iconView, kHeightScale(50/2))
    .leftSpaceToView(self, kWidthScale(82))
    .widthIs(kWidthScale(50))
    .autoHeightRatio(0);
    
    _modifyName.sd_layout
    .topSpaceToView(self.nickname, kHeightScale(2))
    .leftEqualToView(self.nickname)
    .widthIs(kWidthScale(260))
    .heightIs(kHeightScale(40));
    
    _Line1.sd_layout
    .topSpaceToView(self.modifyName,kHeightScale(3))
    .leftSpaceToView(self,kWidthScale(96/2))
    .rightSpaceToView(self,kWidthScale(96/2))
    .heightIs(kHeightScale(5));
    
    _sexLab.sd_layout
    .topSpaceToView(self.Line1,kHeightScale(10))
    .leftEqualToView(self.nickname)
    .widthIs(kWidthScale(50))
    .heightIs(kHeightScale(20));
    
    _sexTF.sd_layout
    .topSpaceToView(self.sexLab,kHeightScale(2))
    .leftEqualToView(self.modifyName)
    .rightEqualToView(self.modifyName)
    .heightIs(kHeightScale(40));
    
    _Line2.sd_layout
    .topSpaceToView(self.sexTF,kHeightScale(3))
    .leftEqualToView(self.Line1)
    .rightEqualToView(self.Line1)
    .heightIs(kHeightScale(5));
    
    _birthdayLab.sd_layout
    .topSpaceToView(self.Line2,kHeightScale(10))
    .leftEqualToView(self.sexLab)
    .widthIs(kWidthScale(50))
    .heightIs(kHeightScale(20));
    
    _birthdayTF.sd_layout
    .topSpaceToView(self.birthdayLab,kHeightScale(2))
    .leftEqualToView(self.sexTF)
    .rightEqualToView(self.sexTF)
    .heightIs(kHeightScale(40));
    
    _Line3.sd_layout
    .topSpaceToView(self.birthdayTF,kHeightScale(3))
    .leftEqualToView(self.Line2)
    .rightEqualToView(self.Line2)
    .heightIs(kHeightScale(5));
    
    _descriptionLab.sd_layout
    .topSpaceToView(self.Line3,kHeightScale(10))
    .leftEqualToView(self.birthdayLab)
    .widthIs(kWidthScale(100))
    .heightIs(kHeightScale(20));
    
    _descriptionTF.sd_layout
    .topSpaceToView(self.descriptionLab,kHeightScale(2))
    .leftEqualToView(self.birthdayTF)
    .rightEqualToView(self.birthdayTF)
    .heightIs(kHeightScale(40));
    
    _Line4.sd_layout
    .topSpaceToView(self.descriptionTF,kHeightScale(3))
    .leftEqualToView(self.Line3)
    .rightEqualToView(self.Line3)
    .heightIs(kHeightScale(5));
}

- (UITextField *)modifyName
{
    if (!_modifyName) {
        _modifyName=[[UITextField alloc] init];
        _modifyName.placeholder=@"请输入您的昵称";
    }
    return _modifyName;
}
- (UILabel *)nickname
{
    if (!_nickname) {
        _nickname=[[UILabel alloc] init];
        _nickname.text=@"昵称：";
        _nickname.textColor=[UIColor grayColor];
        _nickname.font=[UIFont systemFontOfSize:kWidthScale(15)];
    }
    return _nickname;
}
- (UIView *)iconView
{
    if (!_iconView)
    {
        _iconView=[[UIView alloc] init];
        _iconView.backgroundColor = [UIColor lightGrayColor];
        _iconView.layer.masksToBounds=YES;
        _iconView.layer.cornerRadius=kWidthScale(50);
        _iconView.layer.shadowColor = [UIColor blackColor].CGColor;
        _iconView.layer.shadowOffset = CGSizeMake(-5, 0);
        _iconView.layer.shadowOpacity = 0.5;
        _iconView.layer.shadowRadius = 4.0;
        _iconView.clipsToBounds = NO;
    }
    return _iconView;
}
- (UIButton *)imageIcon
{
    if (!_imageIcon)
    {
        _imageIcon=[[UIButton alloc] init];
        [_imageIcon setBackgroundImage:[UIImage imageNamed:@"1111"] forState:UIControlStateNormal];
        _imageIcon.layer.masksToBounds=YES;
        _imageIcon.layer.cornerRadius=kWidthScale(45);
    }
    return _imageIcon;
}

/*
 @property (nonatomic,strong) UILabel *sexLab; // 性别
 @property (nonatomic,strong) UITextField *sexTF; // 性别输入框
 @property (nonatomic,strong) UILabel *birthdayLab; // 生日
 @property (nonatomic,strong) UITextField *birthdayTF; // 生日输入框
 @property (nonatomic,strong) UILabel *descriptionLab;  // 自我描述
 @property (nonatomic,strong) UITextField *descriptionTF; // 自我描述输入框
 @property (nonatomic,strong) UILabel *hobbyLab; // 个人爱好
 */

- (UILabel *)sexLab
{
    if (!_sexLab)
    {
        _sexLab = [[UILabel alloc] init];
        _sexLab.text = @"性别：";
        _sexLab.textColor = [UIColor grayColor];
        _sexLab.font=[UIFont systemFontOfSize:kWidthScale(15)];
    }
    return _sexLab;
}

- (UITextField *)sexTF
{
    if (!_sexTF)
    {
        _sexTF = [[UITextField alloc] init];
        _sexTF.placeholder = @"请输入您的性别";
    }
    return _sexTF;
}

- (UILabel *)birthdayLab
{
    if (!_birthdayLab)
    {
        _birthdayLab = [[UILabel alloc] init];
        _birthdayLab.text = @"生日：";
        _birthdayLab.textColor = [UIColor grayColor];
        _birthdayLab.font = [UIFont systemFontOfSize:kWidthScale(15)];
    }
    return _birthdayLab;
}

- (UITextField *)birthdayTF
{
    if (!_birthdayTF)
    {
        _birthdayTF = [[UITextField alloc] init];
        _birthdayTF.placeholder = @"格式为1111-11-11";
    }
    return _birthdayTF;
}

- (UILabel *)descriptionLab
{
    if (!_descriptionLab)
    {
        _descriptionLab = [[UILabel alloc] init];
        _descriptionLab.text = @"自我描述：";
        _descriptionLab.textColor = [UIColor grayColor];
        _descriptionLab.font = [UIFont systemFontOfSize:kWidthScale(15)];
    }
    return _descriptionLab;
}

- (UITextField *)descriptionTF
{
    if (!_descriptionTF)
    {
        _descriptionTF = [[UITextField alloc] init];
        _descriptionTF.placeholder = @"用一句话来描述自己的实力吧！";
    }
    return _descriptionTF;
}

- (UILabel *)hobbyLab
{
    if (!_hobbyLab)
    {
        _hobbyLab = [[UILabel alloc] init];
        _hobbyLab.text = @"个人爱好";
    }
    return _hobbyLab;
}

- (UIImageView *)Line1
{
    if (!_Line1)
    {
        _Line1 = [[UIImageView alloc] init];
    }
    return _Line1;
}

- (UIImageView *)Line2
{
    if (!_Line2)
    {
        _Line2 = [[UIImageView alloc] init];
    }
    return _Line2;
}

- (UIImageView *)Line3
{
    if (!_Line3)
    {
        _Line3 = [[UIImageView alloc] init];
    }
    return _Line3;
}

- (UIImageView *)Line4
{
    if (!_Line4)
    {
        _Line4 = [[UIImageView alloc] init];
    }
    return _Line4;
}

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
    textField.layer.cornerRadius=8.0f;
    textField.layer.masksToBounds=YES;
    textField.layer.borderColor=[[UIColor redColor]CGColor];
    textField.layer.borderWidth= 1.0f;
    return YES;
}





@end
